package cn.com.czpb.client.module.personal.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import cn.com.czpb.client.R;

import java.util.List;

/**
 * Created by Administrator on 2017/8/9.
 */

public class MessageFragmentAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> list;
    private String[] titles = new String[]{"评价我的", "通知"};
    private Context context;
    View view;
    TextView tv;

    public MessageFragmentAdapter(FragmentManager fm, List<Fragment> list, Context context) {
        super(fm);
        this.list = list;
        this.context = context;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return 2;
    }

    public View getTabView(int position) {
        if (position==0){
            view= LayoutInflater.from(context).inflate(R.layout.tab_comment, null);
             tv= view.findViewById(R.id.comment_mine);

        }else {
            view= LayoutInflater.from(context).inflate(R.layout.tab_message, null);
            tv = view.findViewById(R.id.notify);
        }

        tv.setText(titles[position]);

        return view;
    }


    @Override
    public CharSequence getPageTitle(int position) {

//        return titles[position];
        return null;
    }

}
